package types// Reference: https://www.ietf.org/rfc/rfc4120.txt// Section: 5.2.8import ()// NewKrbFlags returns an ASN1 BitString struct of the right size for KrbFlags.func () asn1.BitString { := asn1.BitString{} .Bytes = make([]byte, 4) .BitLength = len(.Bytes) * 8return}// SetFlags sets the flags of an ASN1 BitString.func ( *asn1.BitString, []int) {for , := range {SetFlag(, ) }}// SetFlag sets a flag in an ASN1 BitString.func ( *asn1.BitString, int) {for := len(.Bytes); < 4; ++ { (*).Bytes = append((*).Bytes, byte(0)) (*).BitLength = len((*).Bytes) * 8 }//Which byte? := / 8//Which bit in byte := uint(7 - ( - 8*)) (*).Bytes[] = (*).Bytes[] | (1 << )}// UnsetFlags unsets flags in an ASN1 BitString.func ( *asn1.BitString, []int) {for , := range {UnsetFlag(, ) }}// UnsetFlag unsets a flag in an ASN1 BitString.func ( *asn1.BitString, int) {for := len(.Bytes); < 4; ++ { (*).Bytes = append((*).Bytes, byte(0)) (*).BitLength = len((*).Bytes) * 8 }//Which byte? := / 8//Which bit in byte := uint(7 - ( - 8*)) (*).Bytes[] = (*).Bytes[] &^ (1 << )}// IsFlagSet tests if a flag is set in the ASN1 BitString.func ( *asn1.BitString, int) bool {//Which byte? := / 8//Which bit in byte := uint(7 - ( - 8*))if (*).Bytes[]&(1<<) != 0 {returntrue }returnfalse}
The pages are generated with Goldsv0.6.7. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds.